Skip to content

Add Tuya water leak sensor _TZE284_1di7ujzp#4845

Open
ko-maren wants to merge 3 commits intozigpy:devfrom
ko-maren:feat/ts0601-tze284-1di7ujzp-water
Open

Add Tuya water leak sensor _TZE284_1di7ujzp#4845
ko-maren wants to merge 3 commits intozigpy:devfrom
ko-maren:feat/ts0601-tze284-1di7ujzp-water

Conversation

@ko-maren
Copy link
Copy Markdown

@ko-maren ko-maren commented Mar 22, 2026

Proposed change

Add support for the Tuya water leak sensor _TZE284_1di7ujzp / TS0601 (Nous E13).

Additional information

Added previously unsupported device and new quirk. I am new to quirks, so not sure if I met all criteria, please let me know if I did something wrong.

Should close #4823

Also added tests to verify the different datapoint values. Ran locally:

  • uv run pytest tests/test_tuya_water_leak.py -q
  • uv run pre-commit run --all-files

Device diagnostics

zha-01JR32Z6V61S31ESE3H7JM9ZN5-_TZE284_1di7ujzp TS0601-c0f3253a6c179e9f9f4ac08ebb611adb.json

Checklist

  • The changes are tested and work correctly
  • pre-commit checks pass / the code has been formatted using Black
  • Tests have been added to verify that the new code works
  • Device diagnostics data has been attached

Copilot AI review requested due to automatic review settings March 22, 2026 16:47
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.76%. Comparing base (c5634ab) to head (0e83e19).
⚠️ Report is 20 commits behind head on dev.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev    #4845   +/-   ##
=======================================
  Coverage   92.76%   92.76%           
=======================================
  Files         385      386    +1     
  Lines       12818    12833   +15     
=======================================
+ Hits        11890    11905   +15     
  Misses        928      928           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new Tuya v2 quirk to support the Nous E13 water leak sensor (_TZE284_1di7ujzp / TS0601) so ZHA creates appropriate entities and interprets incoming Tuya DP reports.

Changes:

  • Added a new Tuya quirk defining DPs for water presence/leak, battery, and configurable alarm settings.
  • Added a dedicated test module that feeds Tuya frames into the Tuya manufacturer cluster and asserts resulting attribute updates.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

File Description
zhaquirks/tuya/ts0601_water_leak.py Registers a new TuyaQuirkBuilder-based quirk for the _TZE284_1di7ujzp TS0601 leak sensor (binary sensors + battery + enums).
tests/test_tuya_water_leak.py Adds tests validating Tuya DP reports update the expected clusters/attributes for this device.

# device_version=1
# input_clusters=[4, 5, 61184, 0, 60672]
# output_clusters=[25, 10]>
TuyaQuirkBuilder(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you wrap this with parentheses? See other quirks using TuyaQuirkBuilder or QuirkBuilder.
E.g. something like this:

(
    QuirkBuilder("", "")
    .something()
    .add_to_registry()
)

@TheJulianJES TheJulianJES added the Tuya Request/PR regarding a Tuya device label Mar 24, 2026
@TheJulianJES TheJulianJES changed the title Add TS0601 _TZE284_1di7ujzp water leak sensor Add Tuya water leak sensor _TZE284_1di7ujzp Mar 24, 2026
Copy link
Copy Markdown
Collaborator

@TheJulianJES TheJulianJES left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also don't really need a test for this quirk, as it's basically a "definition-only quirk", with no code that needs to be tested.

And already thanks for the PR btw!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Tuya Request/PR regarding a Tuya device

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NOUS E13 Water Leak Sensor

3 participants